<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="m" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="l" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="k" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="a" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen"
	href="css/main.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" >
	function changecolor(var1){
		$(".fbbox:last").addClass(var1);
	}
</script>
<title>Attending List</title>
</head>
<body>
<%@ include file="./header.jsp"%>
<div class="main">
	<div class="links">
		[<a href="./newEvent.jsp">add new event</a>]<br/>
		[<a href="./addressbook">addressbook</a>]<br/>
	</div>
    <div class="content">	
	<ul >
		<li >	
			<div class="fbbox" style="width: 500px;">
			<c:if test="${not empty eventToView.image}">
		 		<img class="eventImage" name="eventImage" title="eventImage"	src="./images/${eventToView.image}">
		 		</c:if>
			   <a:if test="${eventToView.canceled == false}">
				<a:if test="${eventToView.startTime > now}">
					Aktivan dogadjaj:			
					<script type="text/javascript">			  			     
						changecolor("fbgreenbox");
					</script>
				</a:if>
				<a:if test="${eventToView.startTime <= now}">	
					Istekao dogadjaj:
					<script type="text/javascript">			  			     
				changecolor("fbbluebox");
					</script>					  			     
				</a:if>
		    </a:if>
		    <a:if test="${eventToView.canceled}">
					Otkazan dogadjaj:
					<script type="text/javascript">			  			     
						changecolor("fberrorbox");
					</script>					  			     
		    </a:if>
		 			Naziv: ${eventToView.title}<br/>
		 			Opis: ${eventToView.description}<br/>
		 			Pocetak: ${eventToView.startTime}<br/>
		 			Kraj: ${eventToView.endTime}<br/>
		 			Vreme za prijavu: ${eventToView.checkTime}<br/>
		 			Mesto: ${eventToView.place}<br/>
				</div> 
				<div class="fbinfobox" style="width: 500px;">  
					<a:if test="${fn:length(eventToView.attending) !=0}">						  			     
				    	<a href="./event?id=${eventToView.id}&c=1">Dolazi (${fn:length(eventToView.attending)})</a>&nbsp;&nbsp;				     	
					</a:if>
					<a:if test="${fn:length(eventToView.attending) ==0}">						  			     
				    	Dolazi (0)&nbsp;&nbsp;				     	
					</a:if>
					
					<a:if test="${fn:length(eventToView.notAttending) !=0}">						  			     
						<a href="./event?id=${eventToView.id}&c=2">Ne dolazi (${fn:length(eventToView.notAttending)})</a>&nbsp;&nbsp;				     	
					</a:if>
					<a:if test="${fn:length(eventToView.notAttending) ==0}">						  			     
						Ne dolazi (0)&nbsp;&nbsp;				     	
					</a:if>
					
					<a:if test="${fn:length(eventToView.maybeAttending) !=0}">						  			     
						<a href="./event?id=${eventToView.id}&c=3">Pogledalo (${fn:length(eventToView.maybeAttending)})</a>				     	
					</a:if>
					<a:if test="${fn:length(eventToView.maybeAttending) ==0}">						  			     
						Pogledalo (0)			     	
					</a:if>      	
					<a:if test="${fn:length(eventToView.unanswered) !=0}">						  			     
						<a href="./event?id=${eventToView.id}&c=4">Nije pogledalo (${fn:length(eventToView.unanswered)})</a>				     	
					</a:if>
					<a:if test="${fn:length(eventToView.unanswered) ==0}">						  			     
						Nije pogledalo (0)			     	
					</a:if>     
		        </div>
		        <h2>Prisustvovaće:</h2><br/>   
		        <c:forEach items="${eventToView.attending}" var="contact" >
		        	<div class="fbgreybox" style="width: 400px;">  
										${contact.firstName} ${contact.lastName} ${contact.email}<br/>
							    </div> 		
			    </c:forEach>	
			</li>
		
	</ul>
	</div>
</div>
</body>
</html>